package com.serviceImpl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.bean.Food;
import com.mapper.FoodMapper;
import com.service.FoodService;

/**
 * @author  author : 张鹏
 * @date createTime：2018年1月10日 下午10:50:54 
 * @Description: 该类的功能描述
 */
@Service
public class FoodServiceImpl implements FoodService {
	@Resource
	private FoodMapper foodMappser;
	
	
	@Override
	public List<Food> getAllFood() {
		return foodMappser.selectAll();
	}

	@Override
	public int createNewFood(Food food) {
		return foodMappser.insert(food);
	}

	@Override
	public int deleteFood(int foodId) {
		
		return foodMappser.deleteByPrimaryKey(foodId);
	}

	@Override
	public int editFood(Food food) {
		return foodMappser.updateByPrimaryKey(food);
	}

	@Override
	public Food getFoodByPrimaryKey(int foodId) {
		return foodMappser.selectByPrimaryKey(foodId);
	}

	@Override
	public List<Food> getFoodByClassificationId(int classificationId) {
		return foodMappser.selectByClassificationId(classificationId);
	}

	@Override
	public List<Food> getFoodByFoodNameOrPinyin(String searchWords) {
		// TODO Auto-generated method stub
		return foodMappser.selectByFoodNameOrPinyin(searchWords);
	}

}
